var body2 = document.querySelector(".body2")
var span1 = body2.querySelector(".span1")
var span2 = body2.querySelector(".span2")
var u = document.querySelector(".ul")
var biao = document.querySelector(".biao")
var s = biao.querySelector("span")
var i = biao.querySelector("img")
window.onload = function () {
    var ul = document.createElement("ul")
    ul.className = "ul1"
    u.appendChild(ul)
    span2.className = "span2"
    span1.className = "span1 ssp"
    var obj = new XMLHttpRequest() || new ActiveXObject('Microsoft.XMLHTTP');
    obj.open('get', 'http://localhost:3000/useing/public', true);
    obj.send();
    obj.onreadystatechange = function () {
        if (obj.readyState == 4 && obj.status == 200) {
            console.log(obj.responseText);
            var list = JSON.parse(obj.responseText)
            console.log(list);
            for (var i = 0; i < list.length; i++) {
                console.log(list[i]);
                var li = document.createElement("li")
                li.className = "li"
                ul.appendChild(li)
                var img = document.createElement("img")
                img.src = '' + list[i].img + ''
                img.className = "img"
                li.appendChild(img)
                var div = document.createElement("div")
                div.innerHTML = '' + list[i].info_ty + ''
                div.className = "div1"
                li.appendChild(div)
                var p = document.createElement("p")
                p.innerHTML = '' + list[i].text + ''
                p.className = "p"
                li.appendChild(p)
                var span5 = document.createElement("span")
                span5.innerHTML = '' + list[i].totalnum + ''
                span5.className = "span5"
                li.appendChild(span5)
                var span6 = document.createElement("span")
                span6.innerHTML = '' + list[i].num + ''
                span6.className = "span6"
                li.appendChild(span6)
                var span7 = document.createElement("span")
                span7.innerHTML = '' + list[i].apply + ''
                span7.className = "span7"
                li.appendChild(span7)
                var span8 = document.createElement("span")
                span8.innerHTML = '' + list[i].uName + ''
                span8.className = "span8"
                li.appendChild(span8)
                var span9 = document.createElement("span")
                span9.innerHTML = '' + list[i].endTime + ''
                span9.className = "span9"
                li.appendChild(span9)
            }
            var lss = document.querySelectorAll("li")
            for (var j = 13; j < lss.length; j++) {
                lss[j].style.display = "none"
            }
            s.onclick = function () {
                s.innerHTML = "没有更多了"
                i.src = ""
                for (var j = 13; j < lss.length; j++) {
                    lss[j].style.display = "block"
                }
            }
        }
    }
}

////////
////////
span1.addEventListener("click", function () {
    s.innerHTML = "点击加载更多"
    var ul1 = document.querySelector(".ul1")
    var ll = ul1.querySelectorAll("li")
    span2.className = "span2"
    span1.className = "span1 ssp"
    var obj = new XMLHttpRequest() || new ActiveXObject('Microsoft.XMLHTTP');
    obj.open('get', 'http://localhost:3000/useing/public', true);
    obj.send();
    obj.onreadystatechange = function () {
        if (obj.readyState == 4 && obj.status == 200) {
            console.log(obj.responseText);
            var list = JSON.parse(obj.responseText)
            console.log(list);
            for (var i = 0; i < list.length; i++) {
                var img = ll[i].querySelector("img")
                img.src = '' + list[i].img + ''
                var div = ll[i].querySelector("div")
                div.innerHTML = '' + list[i].info_ty + ''
                var p = ll[i].querySelector("p")
                p.innerHTML = '' + list[i].text + ''
                var span5 = ll[i].querySelector(".span5")
                span5.innerHTML = '' + list[i].totalnum + ''
                var span6 = ll[i].querySelector(".span6")
                span6.innerHTML = '' + list[i].num + ''
                var span7 = ll[i].querySelector(".span7")
                span7.innerHTML = '' + list[i].apply + ''
                var span8 = ll[i].querySelector(".span8")
                span8.innerHTML = '' + list[i].uName + ''
                var span9 = ll[i].querySelector(".span9")
                span9.innerHTML = '' + list[i].endTime + ''
            }
            var lss = document.querySelectorAll("li")
            for (var j = 13; j < lss.length; j++) {
                lss[j].style.display = "none"
            }
            s.onclick = function () {
                s.innerHTML = "没有更多了"
                i.src = ""
                for (var j = 13; j < lss.length; j++) {
                    lss[j].style.display = "block"
                }
            }
        }
    }
})

/////////////
////////////
span2.addEventListener("click", function () {
    s.innerHTML = "点击加载更多"
    var lss = document.querySelectorAll("li")
    for (var j = 13; j < lss.length; j++) {
        lss[j].style.display = "none"
    }
    var ul1 = document.querySelector(".ul1")
    var ll = ul1.querySelectorAll("li")
    span2.className = "span2 ssp"
    span1.className = "span1 "
    var obj = new XMLHttpRequest() || new ActiveXObject('Microsoft.XMLHTTP');
    obj.open('get', 'http://localhost:3000/useing/master', true);
    obj.send();
    obj.onreadystatechange = function () {
        if (obj.readyState == 4 && obj.status == 200) {
            console.log(obj.responseText);
            var list = JSON.parse(obj.responseText)
            console.log(list);
            for (var i = 0; i < list.length; i++) {
                var img = ll[i].querySelector("img")
                img.src = '' + list[i].img + ''
                var div = ll[i].querySelector("div")
                div.innerHTML = '' + list[i].info_ty + ''
                var p = ll[i].querySelector("p")
                p.innerHTML = '' + list[i].text + ''
                var span5 = ll[i].querySelector(".span5")
                span5.innerHTML = '' + list[i].totalnum + ''
                var span6 = ll[i].querySelector(".span6")
                span6.innerHTML = '' + list[i].num + ''
                var span7 = ll[i].querySelector(".span7")
                span7.innerHTML = '' + list[i].apply + ''
                var span8 = ll[i].querySelector(".span8")
                span8.innerHTML = '' + list[i].uName + ''
                var span9 = ll[i].querySelector(".span9")
                span9.innerHTML = '' + list[i].endTime + ''
            }
            s.onclick = function () {
                s.innerHTML = "没有更多了"
                i.src = ""
                for (var j = 13; j < lss.length; j++) {
                    lss[j].style.display = "block"
                }
            }
        }
    }
})